package com.application.fragment;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.application.BR;
import com.application.R;
import com.application.base.BaseFragment;
import com.application.databinding.FragmentFirstMovieBinding;
import com.application.databinding.FragmentFirstMusicBinding;
import com.application.viewmodel.FirstViewModel;

import java.util.ResourceBundle;

public class FirstMovieFragment extends BaseFragment<FragmentFirstMovieBinding, FirstViewModel> {

    public FirstMovieFragment() {
    }

    public static FirstMovieFragment newInstance() {
        return new FirstMovieFragment();
    }

    @Override
    protected int initLayoutId() {
        return R.layout.fragment_first_movie;
    }

    @Override
    protected int initVariableId() {
        return BR.movieViewModel;
    }

    @Override
    protected FirstViewModel initViewModel() {
        if (getParentFragment() instanceof FirstFragment) {
            return ((FirstFragment) getParentFragment()).viewModel;
        }
        return null;
    }

    @Override
    protected void initData() {
        super.initData();
        binding.setFragment(this);
        if (viewModel != null) {
            String movieData = viewModel.getTabTitles().getValue().get(2);
            binding.setMovieData(movieData);
        }
    }
}